package com.koron.css2.meterService.impl;

import com.koron.css2.ImportExcelInterface;
import com.koron.css2.common.dto.HeaderInfoDto;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.springframework.web.multipart.MultipartFile;
import org.swan.bean.MessageBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 水表入库模板导入
 * @author bin
 *
 */
public class MsStorageImport implements ImportExcelInterface{

	@Override
	public MessageBean<?> importExel(SessionFactory factory, UserInfoBean userInfo, RequestBean req,List<Map<String, String>> data, MultipartFile file) {
		@SuppressWarnings("rawtypes")
		MessageBean<Map> message = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "导入成功", Map.class);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("list", data);
		message.setData(map);
		return message;
	}

	@Override
	public List<HeaderInfoDto> getHeaderInfo(UserInfoBean userInfo) {
		List<HeaderInfoDto> headerInfos = new ArrayList<HeaderInfoDto>();
		headerInfos.add(new HeaderInfoDto("水表编号", true, "meterNo"));
		headerInfos.add(new HeaderInfoDto("水表表身号", true, "factoryNo"));
		headerInfos.add(new HeaderInfoDto("IMEI", true, "imei"));
		headerInfos.add(new HeaderInfoDto("IMSI", true, "imsi"));
		headerInfos.add(new HeaderInfoDto("SIM", true, "sim"));
		headerInfos.add(new HeaderInfoDto("合格证号", true, "meterCert"));
		
		return headerInfos;
	}

	@Override
	public boolean isCheckHeader() {
		return true;
	}

}
